<table class="table table-bordered table-hover table-striped">
	<tbody>
		<tr align="center">
			<td width="5%"><strong>编号</strong></td>
			<td width="20%"><strong>房卡号</strong></td>
			<td width="20%"><strong>房卡UDID</strong></td>
			<td width="10%"><strong>操作</strong></td>
		</tr>
		<?php if($list){ foreach($list as $k=>$ls){ ?>
		<tr align="center">
			<td><?php echo ($page-1)*C('PAGE_SIZE')+($k+1); ?></td>
			<td>{$ls['card']}</td>
			<td>{$ls['card_udid']}</td>
			<td>
				<a href="javascript:void(0);" card_id="{$ls['id']}" class="icon-edit"></a> 
				<a href="javascript:void(0);" card_id="{$ls['id']}" class="icon-trash delete"></a>
			</td>
		</tr>
		<?php } }else{ ?>
		<tr align="center">
			<td colspan="14">暂无数据...</td>
		</tr>
		<?php } ?>
	</tbody>
</table>
<div class="pagination" style="float: right; widht: 95%">
	<include file="Common/page" />
</div>
<script>
	$(document).ready(function(){
		$("a.delete").on('click', function(){
			if (confirm("确认删除？") == true){
				var obj = $(this);
				var card_id = obj.attr('card_id');
				$.post("remove.html",{id: card_id, type: 'card'}, function(data){
					if(data/1){
						alert('删除成功');
						obj.parent('td').parent('tr').remove();
					}else{
						alert('删除失败');
					}
				});
			}
		});
		
		$(".icon-edit").on('click', function(){
			$.get('card.html', {card_id: $(this).attr('card_id')}, function(data){
				if(data.errCode/1){
					$("#card").val(data.info.card);
					$("#card_udid").val(data.info.card_udid);
					$("#card_id").val(data.info.id);
				}
			},"JSON");
		});
	});
</script>